﻿using Direct.IDAL;
using DirectSell.BLL.EFBase;
using DirectSell.Common.Log;
using DirectSell.Model;
using DirectSell.Model.Log;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static DirectSell.Common.Log.MyLog;

namespace DirectSell.BLL
{
    public abstract class BaseService
    {

        #region 日志记录--郭文昊--2018年10月7日21:03:49
        /// <summary>
        /// 日志文件名
        /// </summary>
        protected virtual string LogFile { get; set; }
        /// <summary>
        /// 日志文件夹
        /// </summary>
        protected virtual string LogFolder { get; set; }
        /// <summary>
        /// 日志记录异步
        /// </summary>
        /// <param name="message">信息</param>
        /// <param name="level">等级</param>
        public async Task LogAsync(object message, MyLogLevel level = MyLogLevel.Info)
        {
            await Task.Run(()=> MyLog.Log(message, LogFile, LogFolder, level));
        }
        /// <summary>
        /// 日志记录
        /// </summary>
        /// <param name="message"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public void  Log(object message, MyLogLevel level = MyLogLevel.Info)
        {
           MyLog.Log(message, LogFile, LogFolder, level);
        }
        #endregion

    }
}
